import request from "@/utils/request";

function page(current, size, courseName, approverName,
    approvalStatus) {
    return request({
        method: 'GET',
        url: '/paper_application/page',
        params: {
            current: current,
            size: size,
            courseName: courseName,
            approverName: approverName,
            approvalStatus: approvalStatus,
        }
    });
}

function page_by_id(current, size, applicantId, courseName, 
    approverName, approvalStatus
) {
    return request({
        method: 'GET',
        url: '/paper_application/page_by_applicant_id',
        params: {
            current: current,
            size: size,
            applicantId: applicantId,
            courseName: courseName,
            approverName: approverName,
            approvalStatus: approvalStatus,
        }
    });
}

function add(courseId, applicantId, paperContent) {
    return request({
        method: 'POST',
        url: '/paper_application',
        data: {
            courseId: courseId,
            applicantId: applicantId,
            paperContent: paperContent,
        }
    });
}

function edit(id, courseId, applicantId, paperContent) {
    return request({
        method: 'PUT',
        url: '/paper_application',
        data: {
            id: id,
            courseId: courseId,
            applicantId: applicantId,
            paperContent: paperContent,
        }
    });
}

function del(id) {
    return request({
        method: 'DELETE',
        url: `/paper_application/${id}`,
    });
}

export default {
    page,
    page_by_id,
    add,
    edit,
    del
}